'use strict';
const db = uniCloud.database();
exports.main = async (event, context) => {
	//event为客户端上传的参数
	let status=2;
	let res_msg="";
	let body=event.body
	let body_json=JSON.parse(body)
	let title=body_json.title
	let content=body_json.content
	let time=body_json.time
	let notice={
		"title":title,
		"content":content,
		"time":time
	}
	const collection = db.collection('Notice');
	let res=await collection.add(notice);
	res_msg="发布成功"
	//返回数据给客户端
	return {"status":status,"res_msg":res_msg}

};